using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Material.Entity;
using System.Configuration;

namespace Material.App
{
    public partial class FrmPencarianPembelian : Form
    {
        private string connStr = ConfigurationManager.ConnectionStrings["dbconnection"].ToString();

        public FrmPencarianPembelian()
        {
            InitializeComponent();

            dataGridView1.RowsDefaultCellStyle.BackColor = Color.Bisque;
            dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige;
            dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.None;

            dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Green;
            dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Yellow;

            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            BindGridData();
        }

        private void BindGridData()
        {
            TblBarangEntity tbl = new TblBarangEntity(connStr);

           // tbl = new TblTransPenjBarangDTLEntity(connStr);
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource = tbl.GetDataPencarianPembelian(dateTimePicker1.Value.ToString("dd/MM/yyyy"), dateTimePicker2.Value.ToString("dd/MM/yyyy")).Tables[0];


        }
    }
}